#pragma once
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

class room
{
private:
	double area;
	string type_of_room;
public:
	room()
	{
		area = 0;
		type_of_room = " ";
	}
	~room()
	{
	}
	room(double area, string type_of_room)
	{
		this->area = area;
		this->type_of_room = type_of_room;
	}
	double getArea(){ return area; }
	string getType_of_room(){ return type_of_room; }
	void setArea(double area){ this->area = area; }
	void setType_of_room(string type_of_room){ this->type_of_room = type_of_room; }

	void read()
	{
		cout << "Area: " << area << endl;
		cout << "Typ av rum: " << type_of_room << endl << endl;
	}
	void write()
	{
		cout << "ange typ av rum: ";
		getline(cin, type_of_room);
		cout << "ange area: ";
		cin >> area;
		cout << endl;
	}

	friend ostream& operator<< (ostream &o, const room &room)
	{
		o << "(";
		o << room.area << ",";
		o << room.type_of_room << ")" << endl;
		return o;
	}

	friend istream& operator>> (istream &i, room &room)
	{
		string s;
		getline(i, s, '(');
		getline(i, s, ',');
		istringstream iss(s);
		iss >> room.area;
		getline(i, room.type_of_room, ')');
		return i;
	}

};

